import request from '@/router/axios';

//APQP
//APQP列表不分页
export const getAPQPList = (params) => {
  return request({
    url: '/api/hg-public/apqplist/list',
    method: 'get',
    params: {
      ...params,
    }
  })
}

// 获取产品的apqp文件列表
export const getProductAPQP = (params) => {
  return request({
    url: '/api/hg-public/apqplist/listnopage',
    method: 'get',
    params: {
      ...params,
    }
  })
}
//APQP列表分页
export const getAPQPPage = (current, size, params) => {
  return request({
    url: '/api/hg-public/apqplist/page',
    method: 'get',
    params: {
      current,
      size,
      ...params,
    }
  })
}
//新增APQP
export const addAPQP = (row) => {
  return request({
    url: '/api/hg-public/apqplist/save',
    method: 'post',
    data: row
  })
}

//删除APQP
export const removeAPQP = (productDrawingNos) => {
  return request({
    url: '/api/hg-public/apqplist/remove',
    method: 'post',
    params: {
      productDrawingNos,
    }
  })
}

//更新APQP
export const updateAPQP = (row) => {
  return request({
    url: '/api/hg-public/apqplist/update',
    method: 'post',
    data: row
  })
}

//获取APQP详情
export const getAPQP = (id) => {
  return request({
    url: '/api/hg-public/apqplist/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

//更新APQP附件数量
export const updateAPQPFileCount = (id) => {
  return request({
    url: '/api/hg-public/apqplist/addfilecount',
    method: 'post',
    params: {
      id,
    }
  })
}
//获取所有项目的产品列表flag=1,返回产品类型为产品的 flag=2,返回顶级产品
export const getAllProductList = (params) => {
  return request({
    url: '/api/hg-public/prdinfo/listbytype',
    method: 'get',
    params: {
      ...params,
    }
  })
}